/*
 * @Author: HanXu
 * @Date: 2022-06-07 09:44:22
 * @LastEditors: chenzechao
 * @LastEditTime: 2024-02-05 16:11:10
 * @Description: 描述
 */
import Vue from "vue";
// 集成路由规则
import "babel-polyfill";
import router from "./router";
//使用elementui
import ElementUI, {Message} from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import i18n from './lang'
// 防止el Dialog导致页面抖动
ElementUI.Dialog.props.lockScroll.default=false

ElementUI.Form.props.labelPosition={type: String, default: 'top'}
// 集成vuex
import store from "./store/index.js";
// 全局js方法引入
import "./assets/common/js/global.js";
//引入路由权限控制
// import "./assets/common/js/permission.js";
Vue.config.debug = true;
ElementUI.Form.props.size={type: String, default: 'small'}
import VlTree from '@sangtian152/virtual-tree';
import "@sangtian152/virtual-tree/lib/vl-tree.css";
Vue.use(VlTree);
// 引入全局验证插件
// import "font-awesome/css/font-awesome.min.css";
// 引入自适应文件
import "./assets/common/js/utils/rem";
// 字体文件
import "./assets/common/icon/iconfont.css";
// 字体文件
import "./assets/icon/iconfont.css";
import "./assets/icon-kui/iconfont.css";
// import "./assets/icon_x/iconfont.css";
//引入全局css样式
import "./assets/common/scss/global.scss";

import "./assets/common/css/global.css"
import "./assets/common/css/myElementuiStyle.css"
// import "./assets/common/css/font.css"
Date.prototype.format = function(fmt) {
	var o = {
		"M+" : this.getMonth()+1,                 //月份
		"d+" : this.getDate(),                    //日
		"h+" : this.getHours(),                   //小时
		"m+" : this.getMinutes(),                 //分
		"s+" : this.getSeconds(),                 //秒
		"q+" : Math.floor((this.getMonth()+3)/3), //季度
		"S"  : this.getMilliseconds()             //毫秒
	};
	if(/(y+)/.test(fmt)) {
		fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
	}
	for(var k in o) {
		if(new RegExp("("+ k +")").test(fmt)){
			fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
		}
	}
	return fmt;
}

// 引入全局 table 表格
import BaseGlobalTable from "@/components/BaseGlobalTable";
Vue.component("BaseGlobalTable", BaseGlobalTable);


// 引入自定义指令集
import './assets/common/js/directive'
import rules from './assets/common/js/formRule'
// 全局方法挂载
Vue.prototype.$rules = rules
// 适配操作系统缩放
import DevicePixelRatio from "@/assets/common/js/utils/devicePixelRatio";


import globalWebSocket from '@/assets/common/js/utils/globalWebSocket.js'
Vue.prototype.$globalWebSocket = globalWebSocket
Vue.use(ElementUI, {
	i18n: (key, value) => i18n.t(key, value)
})
// i18n.locale="zh"
// i18n.locale="en-US"
// i18n.locale="zh-CN"
Vue.prototype.i18n=i18n
import App from "./App";
// Vue.use(formCreate);
new Vue({
	router,
	store,
	i18n,
	render: (h) => h(App),
	created() {
		new DevicePixelRatio().init();
	}
}).$mount("#app");
// 去除非开发环境打印代码
// if(process.env.NODE_ENV != 'development'){
// 	console.log = function(){};
// 	console.error = function(){};
// }
